﻿@using SmartStore.Rules
@model IRuleExpression
@{
    var metadata = Model.Descriptor.Metadata;
    var id = string.Concat("rule-value-", Model.Id);
    var min = metadata.Get("min") as float?;
    var max = metadata.Get("max") as float?;
    var step = metadata.Get("step") as float?;

    var value = Model.Value != null
        ? Convert.ToSingle(Model.Value, System.Globalization.CultureInfo.InvariantCulture)
        : (float?)null;
}
<div class="numerictextbox-group flex-grow-1">
	@(Html.Telerik().NumericTextBox<float>()
        .Name(id)
        .EmptyMessage(T("Common.EnterValue"))
        .ButtonTitleUp(T("Common.IncreaseValue"))
        .ButtonTitleDown(T("Common.DecreaseValue"))
        .MinValue(min)
        .MaxValue(max)
        .IncrementStep(step ?? 1)
        .DecimalDigits(4)
        .ClientEvents(x => x.OnChange("onRuleValueChanged"))
        .Value(value)
	)
</div>